/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package KFP;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author $alama
 */
@Entity
@Table(name = "exporter_item")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ExporterItem.findAll", query = "SELECT e FROM ExporterItem e"),
    @NamedQuery(name = "ExporterItem.findByIdExporterItem", query = "SELECT e FROM ExporterItem e WHERE e.idExporterItem = :idExporterItem"),
    @NamedQuery(name = "ExporterItem.findByAmount", query = "SELECT e FROM ExporterItem e WHERE e.amount = :amount")})
public class ExporterItem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idExporter_Item")
    private Integer idExporterItem;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "amount")
    private Double amount;
    @JoinColumn(name = "itemID", referencedColumnName = "idItem")
    @ManyToOne
    private Item itemID;
    @JoinColumn(name = "exporterID", referencedColumnName = "idExporter")
    @ManyToOne
    private Exporter exporterID;

    public ExporterItem() {
    }

    public ExporterItem(Integer idExporterItem) {
        this.idExporterItem = idExporterItem;
    }

    public Integer getIdExporterItem() {
        return idExporterItem;
    }

    public void setIdExporterItem(Integer idExporterItem) {
        this.idExporterItem = idExporterItem;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Item getItemID() {
        return itemID;
    }

    public void setItemID(Item itemID) {
        this.itemID = itemID;
    }

    public Exporter getExporterID() {
        return exporterID;
    }

    public void setExporterID(Exporter exporterID) {
        this.exporterID = exporterID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idExporterItem != null ? idExporterItem.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ExporterItem)) {
            return false;
        }
        ExporterItem other = (ExporterItem) object;
        if ((this.idExporterItem == null && other.idExporterItem != null) || (this.idExporterItem != null && !this.idExporterItem.equals(other.idExporterItem))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "KFP.ExporterItem[ idExporterItem=" + idExporterItem + " ]";
    }
    
}
